home *** CD-ROM | disk | FTP | other *** search
/ Programming an RTS Game with Direct3D / Programming an RTS Game with Direct3D.iso / Examples / Chapter 12 / Example 12.8 / Debug / Shaders / teamCol.ps < prev   
Encoding:
Text File  |  2006-06-23  |  824 b   |  20 lines

  1. //////////////////////////////////////////////////////////////////////////
  2. //                                                                      //
  3. //               Unit Lighting/Teamcolor Vertexshader                   //
  4. //                                                                      //
  5. //                   Written by C. Granberg, 2006                       //
  6. //                                                                      //
  7. //////////////////////////////////////////////////////////////////////////
  8.  
  9. sampler unitTexture;
  10. uniform extern float4 tmCol;
  11.  
  12. float4 Main(float2 UV : TEXCOORD0, float shade : TEXCOORD1) : COLOR
  13. {
  14.     float4 c0 = tex2D(unitTexture, UV);
  15.     float Inv = 1.0f - c0.a;
  16.  
  17.     float4 c1 = float4(c0.rgb * Inv + tmCol.rgb * c0.a, 1.0f);
  18.  
  19.     return c1 * shade;
  20. }